//
//  MYYPersonalCell.m
//  meiyinxiang
//
//  Created by 陈李飞 on 2017/10/23.
//  Copyright © 2017年 hbjApple. All rights reserved.
//

#import "MYYPersonalCell.h"
#import "MYY_Me_Macro.h"

@interface MYYPersonalCell()

@property(nonatomic, strong) UIImageView *iconView;
@property(nonatomic, strong) UILabel *nameView;
@property(nonatomic, strong) UIView *seperatorView;
@property(nonatomic, strong) UILabel *rightLable;
@end

@implementation MYYPersonalCell


#pragma mark - init
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubview:self.iconView];
        [self addSubview:self.nameView];
        [self addSubview:self.seperatorView];
        [self addSubview:self.rightLable];
        [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).with.offset(20);
            make.centerY.equalTo(self);
            make.height.equalTo(@20);
            make.width.equalTo(@20);
        }];
        [self.nameView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.iconView.mas_right).with.offset(12);
            make.centerY.equalTo(self);
        }];
     
//        [self.rightLable mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.right.equalTo(self.indicatorView.mas_left).with.offset(-12);
//            make.centerY.equalTo(self);
//        }];
        
        [self.seperatorView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.iconView.mas_right).with.offset(10);
            make.bottom.right.equalTo(self);
            make.height.equalTo(@0.5);
        }];
    }
    return self;
}

#pragma mark - property
- (UIImageView *)iconView
{
    if (_iconView == nil) {
        _iconView = [UIImageView new];
        _iconView.backgroundColor = [UIColor clearColor];
    }
    return _iconView;
}

- (UILabel *)nameView
{
    if (_nameView == nil) {
        _nameView = [UILabel new];
        _nameView.backgroundColor = [UIColor clearColor];
        _nameView.numberOfLines = 1;
        _nameView.textColor = MYYtitleColor;
        _nameView.font = [UIFont systemFontOfSize:16.0];
        _nameView.text = @"收藏";
    }
    return _nameView;
}
- (UILabel *)rightLable
{
    if (_rightLable == nil) {
        _rightLable = [UILabel new];
        _rightLable.backgroundColor = [UIColor clearColor];
        _rightLable.numberOfLines = 1;
        _rightLable.textColor = QFCTielecColor;
        _rightLable.font = MYYFont(16.0);
    }
    return _rightLable;
}


- (UIView *)seperatorView
{
    if (_seperatorView == nil) {
        _seperatorView = [UIView new];
        _seperatorView.backgroundColor = [UIColor colorWithRed:238/255.0 green:238/255.0 blue:238/255.0 alpha:1.0];
    }
    return _seperatorView;
}

-(void)nameStr:(NSString *)nameStr titiStr:(NSString *)titiStr{
    _iconView.image = [UIImage imageNamed:nameStr];
    _nameView.text      = titiStr;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
